class PrintChar {
  constructor(str,height) {
    this.str = str;
    this.height = height;
  }

  for1()
  {
    let result;
    for (var i = 0; i < this.height; i++)
    {
      result = '';
      for (var j = 0; j < i+1; j++)
      {
        result += this.str;
      }
      console.log(result);
    }

  }

  for2()
  {
    let result;
    for (var i = 0; i < this.height; i++)
    {
      result = '';
      for (var j = this.height; j > i; j--)
      {
        result += this.str;
      }
      console.log(result);
    }

  }

  for3()
  {
    let result;
    for (var i = 0; i < this.height; i++)
    {
      result = '';
      if ( (i % 2) === 0)
      {
        for (var j = this.height; j > i; j--)
        {
          result += this.str;
        }
        console.log(result);
      }
    }
  }
}

var p = new PrintChar('A',10);
console.log('1------------------------');
p.for1();
console.log('2------------------------');
p.for2();
console.log('3------------------------');
p.for3();
